package src.percolation;

import java.io.IOException;
import java.util.Random;

import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;

import src.utils.Utils;

public class Pr3 {

	public static void main(String[] argvs) throws IOException {
		
		
		Random gen = new Random();
		
		long seed = gen.nextLong();
		int large = 150;
		double eps = 0.005;
		double pc = 0.593;
		
		Red myRed = new Red(large,seed);
		
		do {
			myRed.createGrid(pc);
			Utils.printHistogramToFile(myRed.clusterHistogram(),"pr3-pc.csv");
		} while(!myRed.doesPercolate());
		
		do{
			myRed.createGrid(pc*.9);
			Utils.printHistogramToFile(myRed.clusterHistogram(),"pr3-pc*.9.csv");
		} while(!myRed.doesPercolate());
	
		do{
			myRed.createGrid(pc*1.1);
			Utils.printHistogramToFile(myRed.clusterHistogram(),"pr3-pc*1.1.csv");
		} while(!myRed.doesPercolate());
		
		DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
	}
	
	
}
